package com.sharemarking.wa.platform.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sharemarking.wa.common.entity.DriverVerify;
import com.sharemarking.wa.platform.dto.driverVerify.DriverVerifyDto;
import com.sharemarking.wa.platform.dto.driverVerify.TransportOrgListDto;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author dxy
 */
@Repository
public interface DriverVerifyMapper extends BaseMapper<DriverVerify> {
    @Select("SELECT exam_state,reject_reason FROM wa_driver_verify \n" +
            "WHERE member_id = #{memberId}")
    DriverVerify isDriverVerify(Integer memberId);

    @Select("SELECT a.org_id,IFNULL(b.name,b.real_name) AS orgName,a.id,a.name,a.head_img,a.exam_state,a.reject_reason FROM wa_driver_verify a " +
            "LEFT JOIN sys_org b ON a.org_id = b.id " +
            "WHERE a.member_id = #{memberId}")
    DriverVerifyDto getDriverVerifyInfo(Integer memberId);

    List<TransportOrgListDto> getTransportOrgList(Map map);

    @Select("SELECT number FROM wa_org_car WHERE driver_id = #{id}")
    String getCarMemberIdByMemberId(Integer id);


    @Select("SELECT member_id FROM wa_driver_verify WHERE id = #{id}")
    Integer getMemberIdByDriverId(Integer id);

    Integer getTransportOrgListCount(Map map);

    @Select("SELECT COUNT(*) FROM sys_message WHERE member_id = #{memberId} and is_push_sms =0 ")
    Integer getMessageNumber(Integer memberId);
}
